<?php

/**
 * Plant filter form base class.
 *
 * @package    seth
 * @subpackage filter
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePlantFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'country'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'city'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'location'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'coordinates' => new sfWidgetFormFilterInput(),
      'pm'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'path'        => new sfWidgetFormFilterInput(),
      'enable'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'pn'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'type'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'structure'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'est_rad'     => new sfWidgetFormFilterInput(),
      'area'        => new sfWidgetFormFilterInput(),
      'perimeter'   => new sfWidgetFormFilterInput(),
      'tilt'        => new sfWidgetFormFilterInput(),
      'code'        => new sfWidgetFormFilterInput(),
      'owner'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Client'), 'add_empty' => true)),
      'internet'    => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'        => new sfValidatorPass(array('required' => false)),
      'country'     => new sfValidatorPass(array('required' => false)),
      'city'        => new sfValidatorPass(array('required' => false)),
      'location'    => new sfValidatorPass(array('required' => false)),
      'coordinates' => new sfValidatorPass(array('required' => false)),
      'pm'          => new sfValidatorPass(array('required' => false)),
      'path'        => new sfValidatorPass(array('required' => false)),
      'enable'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'pn'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'type'        => new sfValidatorPass(array('required' => false)),
      'structure'   => new sfValidatorPass(array('required' => false)),
      'est_rad'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'area'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'perimeter'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'tilt'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'code'        => new sfValidatorPass(array('required' => false)),
      'owner'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Client'), 'column' => 'id')),
      'internet'    => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('plant_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Plant';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'name'        => 'Text',
      'country'     => 'Text',
      'city'        => 'Text',
      'location'    => 'Text',
      'coordinates' => 'Text',
      'pm'          => 'Text',
      'path'        => 'Text',
      'enable'      => 'Number',
      'pn'          => 'Number',
      'type'        => 'Text',
      'structure'   => 'Text',
      'est_rad'     => 'Number',
      'area'        => 'Number',
      'perimeter'   => 'Number',
      'tilt'        => 'Number',
      'code'        => 'Text',
      'owner'       => 'ForeignKey',
      'internet'    => 'Text',
    );
  }
}
